package com.hotel.system.service.impl;

import com.hotel.common.constant.Constants;
import com.hotel.common.utils.ShiroUtils;
import com.hotel.common.utils.StringUtils;
import com.hotel.system.domain.hotel.Order;
import com.hotel.system.mapper.OrderMapper;
import com.hotel.system.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 岗位信息 服务层处理
 * 
 * @author hotel
 */
@Service
public class OrderServiceImpl implements OrderService
{

    @Autowired
    private OrderMapper orderMapper;


    @Override
    public List<Order> selectOrderList(Order order) {
        if (null == order.getCreateTime()) {
            order.setCreateTime(new Date());
        }
        return orderMapper.selectOrderList(order);
    }
    @Override
    public int insertOrder(Order order)
    {
        order.setDeptId(ShiroUtils.getSysUser().getDeptId());
        order.setCreateBy(ShiroUtils.getLoginName());
        order.setUpdateBy(ShiroUtils.getLoginName());

        return orderMapper.insertOrder(order);
    }


    @Override
    public Order selectOrderId(String id)
    {

        return orderMapper.selectOrderId(id);
    }

    @Override
    public int updateOrder(Order order)
    {
        return orderMapper.updateOrder(order);
    }

    @Override
    public int updateOrderStatus(String ids) {

        return orderMapper.updateOrderStatus(ids);
    }

}
